package com.shouer.doc.dialog;

import android.content.Context;

import com.shouer.doc.R;
import com.shouer.doc.ui.main.model.MainAdvice;

/**
 * Created by YYY-Work on 2017/5/24.
 */

public class AdDialogUtil implements DialogDismissListener{


    private static AdDialogUtil instance;
    private AdDialog adDialog;

    public AdDialogUtil() {
    }

    public static AdDialogUtil getInstance() {
        if (instance == null) {
            synchronized (AdDialogUtil.class) {
                if (instance == null) {
                    instance = new AdDialogUtil();
                }
            }
        }
        return instance;
    }

    public void show(Context context,MainAdvice mainAdvice)
    {
        if (null == adDialog || !adDialog.isShowing()) {
            adDialog = new AdDialog(context, R.style.dialog_untran);
        }
        adDialog.withDialogDismissListener(this).withAdviceModel(mainAdvice).show();
    }


    @Override
    public void onDialogDismiss() {
        adDialog=null;
    }
}
